Skip to content

feat: track auth flow#185

Merged
chaitanyapotti merged 11 commits intomasterfrom
feat/track-auth-flow
Mar 31, 2026
Merged

feat: track auth flow#185
chaitanyapotti merged 11 commits intomasterfrom
feat/track-auth-flow

Conversation

@lwin-kyaw
Copy link
Copy Markdown
Contributor

@lwin-kyaw lwin-kyaw commented Mar 27, 2026

Jira Link

https://consensyssoftware.atlassian.net/browse/EMBED-226

Description

This PR adds Citadel auth flow audit reporting around the share retrieval flow so auth-related events can be correlated with a shared recordId. It also extends the public request interfaces to carry the analytics metadata needed for grouped and provider-based auth flows.

Changes

  • add CitadelAuthFlowAuditParams and CitadelAuditParams in src/helpers/citadelUtils.ts
  • add buildAuditPayload() and callAuditApi() to send audit data to the new /v1/user/audit endpoint
  • update Torus.retrieveShares() to generate or reuse a recordId across the flow
  • update Torus.retrieveShares() to report auth flow audit events during the retrieve/login lifecycle
  • keep signer allow tracking aligned with the same recordId used during share retrieval
  • update Torus.importPrivateKey() to accept and reuse an optional recordId
  • extend VerifierParams with sub_verifier_ids
  • extend RetrieveSharesParams with authConnection
  • extend RetrieveSharesParams with recordId
  • extend ImportKeyParams with recordId

How has this been tested?

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • My code follows the code style of this project. (run lint)
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Note

Medium Risk
Adds new Citadel audit/allow tracking calls and propagates a shared recordId through share-retrieval/import flows, which introduces new network requests and changes request interfaces used by consumers.

Overview
Adds Citadel auth-flow auditing around share retrieval by introducing a new /v1/auth/audit PUT report path and expanding the existing signer allow tracking to use explicit OAuth step flags.

retrieveShares and importPrivateKey now generate or reuse a caller-supplied recordId and report verification success/failure via either the allow API (no recordId provided) or the new audit API (when recordId is provided). Public interfaces are extended to carry analytics metadata (RetrieveSharesParams.authConnection, *.recordId, and VerifierParams.sub_verifier_ids).

Written by Cursor Bugbot for commit c3c05b9. This will update automatically on new commits. Configure here.

@lwin-kyaw
Copy link
Copy Markdown
Contributor Author

This PR depends on the citadel-server PR, https://github.com/Web3Auth/citadel-server/pull/32 and need to deploy the citadel before merging this.

Comment thread src/helpers/citadelUtils.ts
@lwin-kyaw lwin-kyaw changed the title Feat/track auth flow feat: track auth flow Mar 27, 2026
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Comment thread src/torus.ts Outdated
Comment thread src/helpers/citadelUtils.ts
Comment thread src/helpers/citadelUtils.ts
Comment thread src/helpers/citadelUtils.ts Outdated
Comment thread src/helpers/citadelUtils.ts Outdated
@lwin-kyaw lwin-kyaw force-pushed the feat/track-auth-flow branch from d6295cf to f10014c Compare March 30, 2026 10:37
arch1995
arch1995 previously approved these changes Mar 31, 2026
@lwin-kyaw
Copy link
Copy Markdown
Contributor Author

OAuth login initiated

oauth-initiated

OAuth login completed -> verification completed

Screenshot 2026-03-31 at 2 00 08 PM

OAuth login completed -> verification failed

oauth-completed-verified-failed

chaitanyapotti
chaitanyapotti previously approved these changes Mar 31, 2026
@chaitanyapotti chaitanyapotti merged commit 79536dc into master Mar 31, 2026
5 checks passed
@chaitanyapotti chaitanyapotti deleted the feat/track-auth-flow branch March 31, 2026 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants